#ifndef _MESSAGEQUEUE_H_
#define _MESSAGEQUEUE_H_

#include <string>
#include "Message.h"

namespace smq
{
  typedef std::list<MessageHeader> MessageHeaderList; //!< message headers list

  //! message queue
  class MessageQueue
  {
  public:
    MessageQueue();
    virtual ~MessageQueue();

    //! copy constructor(stub)
    MessageQueue(const MessageQueue& rQueue);

    //! copy constructor(stub)
    MessageQueue& operator=(const MessageQueue& rQueue);

    //! add message to queue
    /*! \param rMsg - message to add
      */
    void AddMessage(const Message& rMsg);

    //! remove message from queue
    /*! \param sMsgId - message id
      */
    void RemoveMessage(const std::string& sMsgId);

    //! get message count in queue
    /*! \return message count
      */
    int GetQueueLength();

    //! get last message
    /*! \param  rMsg - (out) last message in queue
    */
    const Message& GetLastMessage() const;

    //! get message headers list
    /*! \param rlsMessageHeaders - (out) message headers
      */
    void GetMessageHeadersList(MessageHeaderList& rlsMessageHeaders) const;

    //! get message by id
    /*! \param sMsgId - message id
        \param rMessage - (out) message
      */
    const Message& GetMessage(const std::string& sMsgId) const;

    //! set default queue limit
    /*! \param  nLimit - queue limit
    */
    void SetQueueLimit(int nLimit = 100);

  private:
    struct MessageQueueImpl;
    MessageQueueImpl* m_pImpl;
  };
}

#endif // _MESSAGEQUEUE_H_
